<?php
/**
* Demand delete
* @author: trungdt
* @since: Mar 2, 2011
*/

if (!defined("EXPONENT")) exit("");
    
    $loc=null;
    $loc->mod="demandmodule";  
    if (exponent_users_isAdmin() ||  permissions_check("manage",$loc)) 
    {
        $id=-1;
        if (isset($_REQUEST['id']))
        {
            $id=intval($_REQUEST['id']);
            $db->delete("witness","demand_id = {$id}");
            $db->delete("demands","id = {$id}");
            exponent_flow_redirect();
        }
        else
        {
            echo SITE_404_HTML;
        }
    }
    else
        echo SITE_403_HTML;

?>